package service;

import java.util.List;

import dao.ISuperDao;
import po.User;

public class SuperService implements ISuperService{
	private ISuperDao superDao;

	public List<User> getAllUndo(){
		String hql = "from User as user where isTutor=null";
		return superDao.findByHql(hql);		
	}
	
	
	public ISuperDao getSuperDao() {
		return superDao;
	}

	public void setSuperDao(ISuperDao superDao) {
		this.superDao = superDao;
	}


	@Override
	public List<User> getAll() {
		// TODO Auto-generated method stub
		String hql = "from User as user";
		return superDao.findByHql(hql);		
	}


	@Override
	public boolean beTutor(int userID) {
		// TODO Auto-generated method stub
		User user = superDao.getUser(userID);
		user.setIsTutor("1");
		superDao.update(user);
		return true;
	}
	
}
